<!DOCTYPE html>
<!-- saved from url=(0038)http://www.cs.unc.edu/~zhew/Leetcoder/ -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <link href="http://www.cs.unc.edu/~zhew/Leetcoder/css/index.css" rel="stylesheet">
 <script async="" src="./Leetcoder_files/analytics.js"></script><script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-43015822-1', 'unc.edu');
  ga('send', 'pageview');

 </script>
 </head>
 <body>
 <table id="leetcode_questions_table" class="tablesorter tablesorter-default">
    <thead><tr class="tablesorter-headerRow"><th data-column="0" class="tablesorter-header" tabindex="0" unselectable="on" style="-webkit-user-select: none;"><div class="tablesorter-header-inner">Id</div></th><th data-column="1" class="tablesorter-header" tabindex="0" unselectable="on" style="-webkit-user-select: none;"><div class="tablesorter-header-inner">Question</div></th><th data-column="2" class="tablesorter-header" tabindex="0" unselectable="on" style="-webkit-user-select: none;"><div class="tablesorter-header-inner">Difficulty</div></th><th data-column="3" class="tablesorter-header" tabindex="0" unselectable="on" style="-webkit-user-select: none;"><div class="tablesorter-header-inner">Frequency</div></th><th data-column="4" class="tablesorter-header" tabindex="0" unselectable="on" style="-webkit-user-select: none;"><div class="tablesorter-header-inner">Data Structures</div></th><th data-column="5" class="tablesorter-header" tabindex="0" unselectable="on" style="-webkit-user-select: none;"><div class="tablesorter-header-inner">Algorithms</div></th></tr></thead>
    <tbody>
    
        <tr><td>1</td><td>Two Sum</td><td>2</td><td>5</td><td>array + set</td><td>sort + two pointers</td></tr>
    
        <tr><td>2</td><td>Add Two Numbers</td><td>3</td><td>4</td><td>linked list</td><td>two pointers + math</td></tr>
    
        <tr><td>3</td><td>Longest Substring Without Repeating Characters</td><td>3</td><td>2</td><td>string + hashtable</td><td>two pointers</td></tr>
    
        <tr><td>4</td><td>Median of Two Sorted Arrays</td><td>5</td><td>3</td><td>array</td><td>binary search</td></tr>
    
        <tr><td>5</td><td>Longest Palindromic Substring</td><td>4</td><td>2</td><td>string</td><td></td></tr>
    
        <tr><td>6</td><td>ZigZag Conversion</td><td>3</td><td>1</td><td>string</td><td></td></tr>
    
        <tr><td>7</td><td>Reverse Integer</td><td>2</td><td>3</td><td></td><td>math</td></tr>
    
        <tr><td>8</td><td>String to Integer (atoi)</td><td>2</td><td>5</td><td>string</td><td>math</td></tr>
    
        <tr><td>9</td><td>Palindrome Number</td><td>2</td><td>2</td><td></td><td>math</td></tr>
    
        <tr><td>10</td><td>Regular Expression Matching</td><td>5</td><td>3</td><td>string</td><td>recursion + dp</td></tr>
    
        <tr><td>11</td><td>Container With Most Water</td><td>3</td><td>2</td><td>array</td><td>two pointers</td></tr>
    
        <tr><td>12</td><td>Integer to Roman</td><td>3</td><td>4</td><td></td><td>math</td></tr>
    
        <tr><td>13</td><td>Roman to Integer</td><td>2</td><td>4</td><td></td><td>math</td></tr>
    
        <tr><td>14</td><td>Longest Common Prefix</td><td>2</td><td>1</td><td>string</td><td></td></tr>
    
        <tr><td>15</td><td>3Sum</td><td>3</td><td>5</td><td>array</td><td>two pointers</td></tr>
    
        <tr><td>16</td><td>3Sum Closest</td><td>3</td><td>1</td><td>array</td><td>two pointers</td></tr>
    
        <tr><td>17</td><td>Letter Combinations of a Phone Number</td><td>3</td><td>3</td><td>string</td><td>dfs</td></tr>
    
        <tr><td>18</td><td>4Sum</td><td>3</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>19</td><td>Remove Nth Node From End of List</td><td>2</td><td>3</td><td>linked list</td><td>two pointers</td></tr>
    
        <tr><td>20</td><td>Valid Parentheses</td><td>2</td><td>5</td><td>string</td><td>stack</td></tr>
    
        <tr><td>21</td><td>Merge Two Sorted Lists</td><td>2</td><td>5</td><td>linked list</td><td>sort + two pointers + merge</td></tr>
    
        <tr><td>22</td><td>Generate Parentheses</td><td>3</td><td>4</td><td>string</td><td>dfs</td></tr>
    
        <tr><td>23</td><td>Merge k Sorted Lists</td><td>3</td><td>4</td><td>linked list + heap</td><td>sort + two pointers + merge</td></tr>
    
        <tr><td>24</td><td>Swap Nodes in Pairs</td><td>2</td><td>4</td><td>linked list</td><td></td></tr>
    
        <tr><td>25</td><td>Reverse Nodes in k-Group</td><td>4</td><td>2</td><td>linked list</td><td>recursion + two pointers</td></tr>
    
        <tr><td>26</td><td>Remove Duplicates from Sorted Array</td><td>1</td><td>3</td><td>array</td><td>two pointers</td></tr>
    
        <tr><td>27</td><td>Remove Element</td><td>1</td><td>4</td><td>array</td><td>two pointers</td></tr>
    
        <tr><td>28</td><td>Implement strStr()</td><td>4</td><td>5</td><td>string</td><td>two pointers + KMP + rolling hash</td></tr>
    
        <tr><td>29</td><td>Divide Two Integers</td><td>4</td><td>3</td><td></td><td>binary search + math</td></tr>
    
        <tr><td>30</td><td>Substring with Concatenation of All Words</td><td>3</td><td>1</td><td>string</td><td>two pointers</td></tr>
    
        <tr><td>31</td><td>Next Permutation</td><td>5</td><td>2</td><td>array</td><td>permutation</td></tr>
    
        <tr><td>32</td><td>Longest Valid Parentheses</td><td>4</td><td>1</td><td>string</td><td>dp</td></tr>
    
        <tr><td>33</td><td>Search in Rotated Sorted Array</td><td>4</td><td>3</td><td>array</td><td>binary search</td></tr>
    
        <tr><td>34</td><td>Search for a Range</td><td>4</td><td>3</td><td>array</td><td>binary search</td></tr>
    
        <tr><td>35</td><td>Search Insert Position</td><td>2</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>36</td><td>Valid Sudoku</td><td>2</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>37</td><td>Sudoku Solver</td><td>4</td><td>2</td><td>array</td><td>dfs</td></tr>
    
        <tr><td>38</td><td>Count and Say</td><td>2</td><td>2</td><td>string</td><td>two pointers</td></tr>
    
        <tr><td>39</td><td>Combination Sum</td><td>3</td><td>3</td><td>array</td><td>combination</td></tr>
    
        <tr><td>40</td><td>Combination Sum II</td><td>4</td><td>2</td><td>array</td><td>combination</td></tr>
    
        <tr><td>41</td><td>First Missing Positive</td><td>5</td><td>2</td><td>array</td><td>sort</td></tr>
    
        <tr><td>42</td><td>Trapping Rain Water</td><td>4</td><td>2</td><td>array</td><td>two pointers + stack</td></tr>
    
        <tr><td>43</td><td>Multiply Strings</td><td>4</td><td>3</td><td>string</td><td>two pointers + math</td></tr>
    
        <tr><td>44</td><td>Wildcard Matching</td><td>5</td><td>3</td><td>string</td><td>recursion + dp + greedy</td></tr>
    
        <tr><td>45</td><td>Jump Game II</td><td>4</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>46</td><td>Permutations</td><td>3</td><td>4</td><td>array</td><td>permutation</td></tr>
    
        <tr><td>47</td><td>Permutations II</td><td>4</td><td>2</td><td>array</td><td>permutation</td></tr>
    
        <tr><td>48</td><td>Rotate Image</td><td>4</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>49</td><td>Anagrams</td><td>3</td><td>4</td><td>string + hashtable</td><td></td></tr>
    
        <tr><td>50</td><td>Pow(x, n)</td><td>3</td><td>5</td><td></td><td>binary search + math</td></tr>
    
        <tr><td>51</td><td>N-Queens</td><td>4</td><td>3</td><td>array</td><td>dfs</td></tr>
    
        <tr><td>52</td><td>N-Queens II</td><td>4</td><td>3</td><td>array</td><td>dfs</td></tr>
    
        <tr><td>53</td><td>Maximum Subarray</td><td>3</td><td>3</td><td>array</td><td>dp</td></tr>
    
        <tr><td>54</td><td>Spiral Matrix</td><td>4</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>55</td><td>Jump Game</td><td>3</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>56</td><td>Merge Intervals</td><td>4</td><td>5</td><td>array + linked list + red-black tree</td><td>sort + merge</td></tr>
    
        <tr><td>57</td><td>Insert Interval</td><td>4</td><td>5</td><td>array + linked list + red-black tree</td><td>sort + merge</td></tr>
    
        <tr><td>58</td><td>Length of Last Word</td><td>1</td><td>1</td><td>string</td><td></td></tr>
    
        <tr><td>59</td><td>Spiral Matrix II</td><td>3</td><td>2</td><td>array</td><td></td></tr>
    
        <tr><td>60</td><td>Permutation Sequence</td><td>5</td><td>1</td><td></td><td>permutation + math</td></tr>
    
        <tr><td>61</td><td>Rotate List</td><td>3</td><td>2</td><td>linked list</td><td>two pointers</td></tr>
    
        <tr><td>62</td><td>Unique Paths</td><td>2</td><td>3</td><td>array</td><td>dp</td></tr>
    
        <tr><td>63</td><td>Unique Paths II</td><td>3</td><td>3</td><td>array</td><td>dp</td></tr>
    
        <tr><td>64</td><td>Minimum Path Sum</td><td>3</td><td>3</td><td>array</td><td>dp</td></tr>
    
        <tr><td>65</td><td>Valid Number</td><td>2</td><td>5</td><td>string</td><td>math</td></tr>
    
        <tr><td>66</td><td>Plus One</td><td>1</td><td>2</td><td>array</td><td>math</td></tr>
    
        <tr><td>67</td><td>Add Binary</td><td>2</td><td>4</td><td>string</td><td>two pointers + math</td></tr>
    
        <tr><td>68</td><td>Text Justification</td><td>4</td><td>2</td><td>string</td><td></td></tr>
    
        <tr><td>69</td><td>Sqrt(x)</td><td>4</td><td>4</td><td></td><td>binary search</td></tr>
    
        <tr><td>70</td><td>Climbing Stairs</td><td>2</td><td>5</td><td></td><td>dp</td></tr>
    
        <tr><td>71</td><td>Simplify Path</td><td>3</td><td>1</td><td>string</td><td>stack</td></tr>
    
        <tr><td>72</td><td>Edit Distance</td><td>4</td><td>3</td><td>string</td><td>dp</td></tr>
    
        <tr><td>73</td><td>Set Matrix Zeroes</td><td>3</td><td>5</td><td>array</td><td></td></tr>
    
        <tr><td>74</td><td>Search a 2D Matrix</td><td>3</td><td>3</td><td>array</td><td>binary search</td></tr>
    
        <tr><td>75</td><td>Sort Colors</td><td>4</td><td>2</td><td>array</td><td>sort + two pointers</td></tr>
    
        <tr><td>76</td><td>Minimum Window Substring</td><td>4</td><td>2</td><td>string</td><td>two pointers</td></tr>
    
        <tr><td>77</td><td>Combinations</td><td>3</td><td>4</td><td></td><td>combination</td></tr>
    
        <tr><td>78</td><td>Subsets</td><td>3</td><td>4</td><td>array</td><td>recursion + combination</td></tr>
    
        <tr><td>79</td><td>Word Search</td><td>3</td><td>4</td><td>array</td><td>dfs</td></tr>
    
        <tr><td>80</td><td>Remove Duplicates from Sorted Array II</td><td>2</td><td>2</td><td>array</td><td>two pointers</td></tr>
    
        <tr><td>81</td><td>Search in Rotated Sorted Array II</td><td>5</td><td>3</td><td>array</td><td>binary search</td></tr>
    
        <tr><td>82</td><td>Remove Duplicates from Sorted List II</td><td>3</td><td>3</td><td>linked list</td><td>recursion + two pointers</td></tr>
    
        <tr><td>83</td><td>Remove Duplicates from Sorted List</td><td>1</td><td>3</td><td>linked list</td><td></td></tr>
    
        <tr><td>84</td><td>Largest Rectangle in Histogram</td><td>5</td><td>2</td><td>array</td><td>stack</td></tr>
    
        <tr><td>85</td><td>Maximal Rectangle</td><td>5</td><td>1</td><td>array</td><td>dp + stack</td></tr>
    
        <tr><td>86</td><td>Partition List</td><td>3</td><td>3</td><td>linked list</td><td>two pointers</td></tr>
    
        <tr><td>87</td><td>Scramble String</td><td>5</td><td>2</td><td>string</td><td>recursion + dp</td></tr>
    
        <tr><td>88</td><td>Merge Sorted Array</td><td>2</td><td>5</td><td>array</td><td>two pointers + merge</td></tr>
    
        <tr><td>89</td><td>Gray Code</td><td>4</td><td>2</td><td></td><td>combination</td></tr>
    
        <tr><td>90</td><td>Subsets II</td><td>4</td><td>2</td><td>array</td><td>recursion + combination</td></tr>
    
        <tr><td>91</td><td>Decode Ways</td><td>3</td><td>4</td><td>string</td><td>recursion + dp</td></tr>
    
        <tr><td>92</td><td>Reverse Linked List II</td><td>3</td><td>2</td><td>linked list</td><td>two pointers</td></tr>
    
        <tr><td>93</td><td>Restore IP Addresses</td><td>3</td><td>3</td><td>string</td><td>dfs</td></tr>
    
        <tr><td>94</td><td>Binary Tree Inorder Traversal</td><td>4</td><td>3</td><td>tree + hashtable</td><td>recursion + morris + stack</td></tr>
    
        <tr><td>95</td><td>Unique Binary Search Trees II</td><td>4</td><td>1</td><td>tree</td><td>dp + dfs</td></tr>
    
        <tr><td>96</td><td>Unique Binary Search Trees</td><td>3</td><td>1</td><td>tree</td><td>dp</td></tr>
    
        <tr><td>97</td><td>Interleaving String</td><td>5</td><td>2</td><td>string</td><td>recursion + dp</td></tr>
    
        <tr><td>98</td><td>Validate Binary Search Tree</td><td>3</td><td>5</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>99</td><td>Recover Binary Search Tree</td><td>4</td><td>2</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>100</td><td>Same Tree</td><td>1</td><td>1</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>101</td><td>Symmetric Tree</td><td>1</td><td>2</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>102</td><td>Binary Tree Level Order Traversal</td><td>3</td><td>4</td><td>tree</td><td>bfs</td></tr>
    
        <tr><td>103</td><td>Binary Tree Zigzag Level Order Traversal</td><td>4</td><td>3</td><td>queue + tree</td><td>bfs + stack</td></tr>
    
        <tr><td>104</td><td>Maximum Depth of Binary Tree</td><td>1</td><td>1</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>105</td><td>Construct Binary Tree from Preorder and Inorder Tr</td><td>3</td><td>3</td><td>array + tree</td><td>dfs</td></tr>
    
        <tr><td>106</td><td>Construct Binary Tree from Inorder and Postorder T</td><td>3</td><td>3</td><td>array + tree</td><td>dfs</td></tr>
    
        <tr><td>107</td><td>Binary Tree Level Order Traversal II</td><td>3</td><td>1</td><td>tree</td><td>bfs</td></tr>
    
        <tr><td>108</td><td>Convert Sorted Array to Binary Search Tree</td><td>2</td><td>3</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>109</td><td>Convert Sorted List to Binary Search Tree</td><td>4</td><td>3</td><td>linked list</td><td>recursion + two pointers</td></tr>
    
        <tr><td>110</td><td>Balanced Binary Tree</td><td>1</td><td>2</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>111</td><td>Minimum Depth of Binary Tree</td><td>1</td><td>1</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>112</td><td>Path Sum</td><td>1</td><td>3</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>113</td><td>Path Sum II</td><td>2</td><td>2</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>114</td><td>Flatten Binary Tree to Linked List</td><td>3</td><td>3</td><td>tree</td><td>recursion + stack</td></tr>
    
        <tr><td>115</td><td>Distinct Subsequences</td><td>4</td><td>2</td><td>string</td><td>dp</td></tr>
    
        <tr><td>116</td><td>Populating Next Right Pointers in Each Node</td><td>3</td><td>3</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>117</td><td>Populating Next Right Pointers in Each Node II</td><td>4</td><td>2</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>118</td><td>Pascal's Triangle</td><td>2</td><td>1</td><td>array</td><td></td></tr>
    
        <tr><td>119</td><td>Pascal's Triangle II</td><td>2</td><td>1</td><td>array</td><td></td></tr>
    
        <tr><td>120</td><td>Triangle</td><td>3</td><td>1</td><td>array</td><td>dp</td></tr>
    
        <tr><td>121</td><td>Best Time to Buy and Sell Stock</td><td>2</td><td>1</td><td>array</td><td>dp</td></tr>
    
        <tr><td>122</td><td>Best Time to Buy and Sell Stock II</td><td>3</td><td>1</td><td>array</td><td>greedy</td></tr>
    
        <tr><td>123</td><td>Best Time to Buy and Sell Stock III</td><td>4</td><td>1</td><td>array</td><td>dp</td></tr>
    
        <tr><td>124</td><td>Binary Tree Maximum Path Sum</td><td>4</td><td>2</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>125</td><td>Valid Palindrome</td><td>2</td><td>5</td><td>string</td><td>two pointers</td></tr>
    
        <tr><td>126</td><td>Word Ladder II</td><td>1</td><td>1</td><td></td><td></td></tr>
    
        <tr><td>127</td><td>Word Ladder</td><td>3</td><td>5</td><td>graph</td><td>bfs + shortest path</td></tr>
    
        <tr><td>128</td><td>Longest Consecutive Sequence</td><td>4</td><td>3</td><td>array</td><td></td></tr>
    
        <tr><td>129</td><td>Sum Root to Leaf Numbers</td><td>2</td><td>4</td><td>tree</td><td>dfs</td></tr>
    
        <tr><td>130</td><td>Surrounded Regions</td><td>4</td><td>3</td><td>array</td><td>bfs + dfs</td></tr>
    
        <tr><td>131</td><td>Palindrome Partitioning</td><td>3</td><td>4</td><td>string</td><td>dfs</td></tr>
    
        <tr><td>132</td><td>Palindrome Partitioning II</td><td>4</td><td>3</td><td>string</td><td>dp</td></tr>
    
    </tbody>
 </table>
 <script id="leetcode_questions_template" type="text/x-handlebars-template">
    <thead><tr><th>Id</th><th>Question</th><th>Difficulty</th><th>Frequency</th><th>Data Structures</th><th>Algorithms</th></tr></thead>
    <tbody>
    {{#each questions}}
        <tr><td>{{Id}}</td><td>{{Question}}</td><td>{{Difficulty}}</td><td>{{Frequency}}</td><td>{{Data_Structures}}</td><td>{{Algorithms}}</td></tr>
    {{/each}}
    </tbody>
 </script>
 <script src="./Leetcoder_files/jquery.min.js"></script>
 <script src="./Leetcoder_files/data.js"></script>
 <script src="./Leetcoder_files/index.js"></script>
 <script src="./Leetcoder_files/jquery.tablesorter.min.js"></script>
 <script src="./Leetcoder_files/handlebars.min.js"></script>
 
</body></html>